package com.erclab.internal.xpresso.reportelements;

import com.erclab.internal.xpresso.exceptions.ReportException;
import com.erclab.internal.xpresso.reports.Report;

public class StarRating extends ReportElement {

	@Override
	public String toHTML(String columnValue, String uniqueKeyValue,	Report theReport) throws ReportException {
		int value = Double.valueOf(Math.round(Double.parseDouble(columnValue))).intValue();
		switch(value){
			case 0:
				return "";
			case 1:
				return "<img src=\"../xpresso/html/images/StarRating1.gif\">";
			case 2:
				return "<img src=\"../xpresso/html/images/StarRating2.gif\">";
			case 3:
				return "<img src=\"../xpresso/html/images/StarRating3.gif\">";
			case 4:
				return "<img src=\"../xpresso/html/images/StarRating4.gif\">";
			case 5:
				return "<img src=\"../xpresso/html/images/StarRating5.gif\">";
		}
		return "";
	}

}
